<%--
  Created by IntelliJ IDEA.
  User: my
  Date: 2020/12/29
  Time: 9:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h1 style="color: red">${message}</h1>
<fieldset>
    <legend>注册</legend>
        <form action="regist.action" method="post">
            <table align="center" width="600px" >
                <tr>
                    <td>用户名</td>
                    <td><input name="phone" list="user" value="${param.phone}" />
                    <datalist id="user">
                        <c:forEach items="${usermap}" var="item">
                        <option value="${item.key}" label="${item.value}"></option>
                        </c:forEach>
                    </datalist>
                    </td>

                </tr>
                <tr>
                    <td>密码</td>
                    <td><input type="password" id="psd" name="password" /></td>
                </tr>
                <tr>
                    <td>确认密码</td>
                    <td><input type="password" id="repsd" onblur="abc()" />
                        <span style="color:red" id="msg"></span>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <button onclick="return abc()" >注册</button>
                        <input type="reset" value="重置" />
                    </td>
                </tr>
            </table>
        </form>
</fieldset>
<script>
    function  abc() {
        if (document.querySelector("#psd").value != document.querySelector("#repsd").value) {
            document.querySelector("#msg").innerHTML="确认密码不正确"
            return false;
        } else {
            document.querySelector("#msg").innerHTML=""
            return true;
        }
    }
    
</script>
</body>
</html>
